# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>

pkgname=meld
pkgver=3.22.0
pkgrel=2
pkgdesc="Compare files, directories and working copies"
url="https://meldmerge.org/"
license=(GPL)
arch=(any)
depends=(python-gobject python-cairo gtksourceview4 gsettings-desktop-schemas
         dconf)
makedepends=(meson yelp-tools git)
checkdepends=(appstream-glib)
_commit=322f05876e841d1fa7a162d4c5a4e15226823b7c  # tags/3.22.0^0
source=("git+https://gitlab.gnome.org/GNOME/meld.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd meld
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd meld
}

build() {
  arch-meson meld build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"
  python -m compileall -d /usr/lib "$pkgdir/usr/lib"
  python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"
}
